/*
 * huirong Inc.
 * Copyright (c) 2019 All Rights Reserved.
 * Author     :liyb
 * Create Date:2019年6月10日
 */
package cn.zs.supply.web.config;

import cn.zs.supply.common.constants.enums.PubErrCode;
import lombok.Data;
import lombok.ToString;

import java.io.Serializable;
@Data
@ToString
public class ResultData implements Serializable{

    private static final long serialVersionUID = -4611669012578622460L;
    private String msg;
    private Integer code;
    private Object data;

    public ResultData() {}
    
    public static ResultData getInstance(Object data) {
        ResultData response = new ResultData();
        response.setCode(0);
        response.setMsg(PubErrCode.SUCCESS.getMsg());
        return response.addData(data);
    }

    public ResultData(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    
    public ResultData addData(Object data) {
        this.data = data;
        return this;
    }
}
